#include<bits/stdc++.h>
#define REP(i,a,b,c) for(int i=a;i<=b;i+=c)
using namespace std;
const int N=1e5+5;
int n,a[N],h[N],pre,ans;
bool flag;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin>>n;
    REP(i,1,n,1){
        cin>>a[i];
        h[a[i]]++;
    }
    REP(i,1,N-5,1){
        if(h[i]){
            if(!flag){
                flag=1;
                pre+=h[i];
                continue;
            }else{
                if(pre>=h[i])
                    ans+=h[i];
                else{
                    ans+=pre;
                    pre=h[i];
                }
            }
        }
    }cout<<n-ans;
    return 0;
}
